package cn.stylefeng.guns.adapter;

import cn.stylefeng.guns.core.UploadFileUtil;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 路径映射适配器
 */
@Configuration
public class URLMappingAdapter implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        /**
         * 资源映射路径
         * addResourceHandler：访问映射路径
         * addResourceLocations：资源绝对路径
         */
        //头像映射路径
        registry.addResourceHandler("/hyRedWineFile/**")
                .addResourceLocations("file:" + UploadFileUtil.PATH);

    }

}
